/* 
 * File:   Draw_time._time
 * Author: faris alotaibi
 *
 * Created on April 5, 2011, 2:27 PM
 */

#ifndef _DRAW_TIME__TIME
#define	_DRAW_TIME__TIME

#ifdef	__cplusplus
extern "C" {
#endif
/**
 * Author: faris fouzan
 * Nickname : faris2007
 * the libary draw time
 */
#include <stdlib.h>
#include <GL/glut.h>
#include <math.h>
#include <ctime>
#include <unistd.h>
#include <pthread.h>

//#define NUM_THREAD 3
/*
 *
 */
//using namespace std;
/*void *Hours(void * threadid);
void *Minutes(void * threadid);
void *Seconds(void * threadid);*/
enum Format {FORMAT_HOUR_MIN_SEC_12=0,FORMAT_HOUR_MIN_SEC_24,FORMAT_HOUR_MIN_12,FORMAT_HOUR_MIN_24};
class DrawTime{

private :
    GLfloat x0,y0 ,width,hight,color[3],background[3];
    int hour,minu,sec;
    GLint VHour[2],VMinu[2],VSec[2],VColon[4],VAm[2],vx,x;
    Format formatDefault;
    tm * ptime;
    void Compute(Format format);
    void Clear();
    void Color();
    void Colon(int number);
    void Hours();
    void Minutes();
    void Seconds();
    void TypeTime();
    void selectNumber(int select,int left,int top, int right,int bottom);
    void square(int left, int top, int right ,int bottom,char side,char type);
    void squareA(int left, int top, int right ,int bottom);
    void draw0(int left,int top,int right,int bottom);
    void draw1(int left,int top,int right,int bottom);
    void draw2(int left,int top,int right,int bottom);
    void draw3(int left,int top,int right,int bottom);
    void draw4(int left,int top,int right,int bottom);
    void draw5(int left,int top,int right,int bottom);
    void draw6(int left,int top,int right,int bottom);
    void draw7(int left,int top,int right,int bottom);
    void draw8(int left,int top,int right,int bottom);
    void draw9(int left,int top,int right,int bottom);
    void drawA(int left,int top,int right,int bottom);
    void drawP(int left,int top,int right,int bottom);
    void drawM(int left,int top,int right,int bottom);
public :
    void initPostion(GLfloat x0 ,GLfloat y0); // here select point the start from left-down
    void initSize(GLfloat width ,GLfloat hight);// here select width and hight for time
    void timeColor(GLfloat red,GLfloat green,GLfloat blue);
    void timeBackground(GLfloat red,GLfloat green,GLfloat blue);
    void Draw_Time(Format format); // execute draw here
    void Time_loop(); // check on time and redraw time
    DrawTime();
    ~DrawTime();
};



#ifdef	__cplusplus
}
#endif

#endif	/* _DRAW_TIME__TIME */

